#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
int main()
{
    char buf[256],*s;
    int r;
    r = mkdir("newdir", 0766); // mkdir syscall if (r <0)
    printf("errno=%d :%s\n", errno,strerror(errno));
    r =chdir("newdir"); // cd into newdir
    s =getcwd(buf,256); // get cwD string into buf[ ]
    printf("CWD =%s\n",s);
}
